import SiderBar from '../SideBar/SideBar';
import Home from './home';
import Driver from './list';
import Store from '../store';
import Scan from '../scan';
import Login from '../login';
import User from '../user/';
import {Icon} from "../../lib/util";
import {ScrollView, StyleSheet, Text, Image} from 'react-native';
import {DrawerNavigator, DrawerItems, SafeAreaView} from 'react-navigation';
import {Thumbnail,View, Root} from '../../lib/components.js';

import React, {Component} from 'react';

const CustomDrawerContentComponent = (props) => {
    const self = this;
    return <ScrollView>
        <SafeAreaView style={styles.container} forceInset={{top: 'always', horizontal: 'never'}}>
            <View style={styles.sum}>
                <Image
                    source={{uri: 'https://s1.ax2x.com/2018/02/20/P4ORa.jpg'}}
                    style={{width: 135, height: 135}}
                />
                <Text style={styles.sumText}>苏伟明</Text>
            </View>
            <DrawerItems {...props} />
        </SafeAreaView>
    </ScrollView>
};

const styles = StyleSheet.create({
    container: {
        flex: 1,
    },
    sum: {
        height: 200,
        flex: 1,
        alignItems: 'center',
    },
    sumText: {
        marginTop:20,
        fontSize:18
    },
});
const Index = DrawerNavigator(
    {
        Home: {
            screen: Home,
            navigationOptions: {
                // drawerLabel: '首页',
                title: '首页',
            },
        },
        Driver: {
            screen: Driver,
            navigationOptions: {
                // drawerLabel: '首页',
                title: '驾驶员列表',
            },
        },
        Store: {
            screen: Store,
            navigationOptions: {
                drawerLabel: '新增',
            },
        },
        Scan: {
            screen: Scan,
            navigationOptions: {
                drawerLabel: '扫码',
            },
        },
        User: {
            screen: User,
            navigationOptions: {
                drawerLabel: '我的',
            },
        },
        Login: {
            screen: Login,
            navigationOptions: {
                drawerLabel: '退出',
            },
        },
    },
    {
        contentComponent: CustomDrawerContentComponent
//         initialRouteName:'Home',
//
// //        contentComponent: props => <SiderBar {...props} />
//         contentOptions: {
//             activeTintColor: '#e91e63',
//             itemsContainerStyle: {
//                 marginVertical: 0,
//             },
//             iconContainerStyle: {
//                 opacity: 1
//             }
//         }
    }
);

export default () =>
    <Root>
        <Index />
    </Root>;
